package com.example.doctorserver.service.impl;

import com.example.doctorserver.mapper.OverallresultMapper;
import com.example.doctorserver.pojo.Overallresult;
import com.example.doctorserver.response.TijianException;
import com.example.doctorserver.response.TijianExceptionEnum;
import com.example.doctorserver.service.OverallResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OverallResultServiceImpl implements OverallResultService {

    @Autowired
    private OverallresultMapper overallresultMapper;

    //查询
    @Override
    public int saveOverallResult(Overallresult overallresult) {
        return overallresultMapper.saveOverallresult(overallresult);
    }

    //删除
    @Override
    public int removeById(Integer orId) {
        overallresultMapper.removeById(orId);
        return 0;
    }

    //更新
    @Override
    public int updateById(Overallresult overallresult) {
        int f=overallresultMapper.updateById(overallresult);
        if (f>0) {
            return 200;
        }else {
            throw new TijianException(TijianExceptionEnum.KDC_ERR_C_PRINCIPAL_UNKNOWN);
        }
    }

    //查询
    @Override
    public List<Overallresult> listOverallResultByOrderId(Integer orderId) {
        return overallresultMapper.listOverallResultByOrderId(orderId);
    }


}
